package com.tank.netty.scoket.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * Created with IntelliJ IDEA.
 * User: SuQiEr
 * Date:2017/5/29 0029
 * Time: 上午 10:57
 * To change this template use File | Settings | File Templates.
 */
public class ClientHandler extends SimpleChannelInboundHandler<String> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {

        System.out.println("remote address :"+ ctx.channel().remoteAddress());
        System.out.println("receive message from server:"+ msg);

        ctx.writeAndFlush("from client");
    }

}
